package org.jeecg.modules.paycenter.service;


import org.jeecg.modules.paycenter.dto.BatchPayDto;
import org.jeecg.modules.paycenter.dto.PayDto;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.wlhy.customer.entity.HyCustomer;
import org.jeecg.modules.wlhy.hyplatform.entity.HyPlatformCost;
import org.jeecg.modules.wlhy.shipping.entity.HyShippingNote;
import org.jeecg.modules.wlhy.utils.R;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author yangqf
 * @date 2023/4/28 21:53
 */
public interface PayService {

    /**
     * 验证运单信息
     * @param hyShippingNote
     * @param payDto
     * @param loginUser
     * @return
     */
    public R checkOrderInfo(HyShippingNote hyShippingNote, PayDto payDto, SysUser loginUser);


    /**
     * 检查支付账号相关信息
     * @param hyShippingNote
     * @param loginUser
     * @return
     */
    public R checkAccountInfo(HyShippingNote hyShippingNote, SysUser loginUser, boolean repayFlag);

    /**
     * 货主批量支付验证账户信息
     * @param hyShippingNoteList
     * @param customer
     * @return
     */
    public R checkAccountInfoBath(List<HyShippingNote> hyShippingNoteList, HyCustomer customer);


    /**
     * 支付前修改运单的状态为支付中
     * @param hyShippingNote
     * @param loginUser
     * @return
     */
    boolean modifyShippingNotePayInfo(HyShippingNote hyShippingNote, SysUser loginUser);

    /**
     * 重新支付前修改运单的状态为支付中
     * @param hyShippingNote
     * @param loginUser
     * @return
     */
    boolean modifyShippingNoteRePayInfo(HyShippingNote hyShippingNote, SysUser loginUser);


    /**
     * 支付成功更新HY_BILL表
     * @param shippingNote
     * @return
     */
    boolean updateHyBill(HyShippingNote shippingNote);

    /**
     * 支付失败更新HY_BILL表
     * @param shippingNote
     * @return
     */
    boolean updateHyBillForFail(HyShippingNote shippingNote);


    /**
     * 平台代付更新
     * @param shippingNote
     * @return
     */
    boolean updateHyBillForPlatePay(HyShippingNote shippingNote, HyPlatformCost platformCost);


    /**
     * 创建各种流水单
     * @param hyShippingNote
     * @return
     */
    boolean createStatement(HyShippingNote hyShippingNote);

    /**
     * 支付流
     * @param hyShippingNote
     * @return
     */
    public R payActivity(HyShippingNote hyShippingNote);

    /**
     * 平台代付
     * @param hyShippingNote
     * @return
     */
    public R platePayActivity(HyShippingNote hyShippingNote);

    /**
     * 批量支付订单信息验证
     * @param shippingNoteList
     * @param batchPayDto
     * @param loginUser
     * @return
     */

    public R checkBatchPayOrderInfo(List<HyShippingNote> shippingNoteList, BatchPayDto batchPayDto, SysUser loginUser);


    public R checkPlateBatchPayOrderInfo(List<HyShippingNote> shippingNoteList, BatchPayDto batchPayDto, SysUser loginUser);

    /**
     * 检查平台支付相关信息
     * @param shippingNoteList
     * @param batchPayDto
     * @param loginUser
     * @return
     */
    public R checkPlateAccountInfo(List<HyShippingNote> shippingNoteList, BatchPayDto batchPayDto, SysUser loginUser);

    /**
     * 平台单笔支付账号校验
     * @param shippingNote
     * @param payDto
     * @param loginUser
     * @return
     */
    public R checkPlateAccountInfoPaySingle(HyShippingNote shippingNote, PayDto payDto, SysUser loginUser, boolean repayFlag);

    /**
     * 平台支付创建流水单
     * @param shippingNoteList
     * @return
     */
    public HyPlatformCost createPlateStatement(List<HyShippingNote> shippingNoteList);

    /**
     * 平台支付创建流水单
     * @param shippingNote
     * @return
     */
    public HyPlatformCost createPlateStatement(HyShippingNote shippingNote, SysUser loginUser);


    /**
     * 平台支付批量修改运单的支付状态
     * @param shippingNote
     * @return
     */
    boolean modifyShippingNoteForPlatePay(HyShippingNote shippingNote, SysUser loginUser, String pateFormCostId);

    /**
     * 平台创建各种流水单
     * @param hyShippingNote
     * @return
     */

    @Transactional
    boolean createStatementForPlatePay(HyShippingNote hyShippingNote);
}
